package com.aios.entity;

public class Switch extends AbstractEntity{

	public static final String CLASS_KEY = "6001";
	public static final String TABLE_KEY = "0701";
	
	public static final int NUMBER_OF_SWITCHES = 12;
	public static final String DEFAULT_LABEL_PREFIX = "SW";
	public static final String PREFIX_LABEL = "Image";
	
	private String name;
	private String icon;
	private String controllerParameter;  //1, 2, 3 .... 12
	private String controllerReceiver;   //image1, image2, ...  image3
	private String switchStyle;
	
	public static final String ON = "1";
	public static final String OFF = "0";
	
	
	public static final String CHECKBOX_CHECKED = "checked";
	public static final String CHECKBOX_UNCHECKED = "";
	
	private String currentState = CHECKBOX_UNCHECKED;
	private String switchPanelId;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}
	public String getControllerParameter() {
		return controllerParameter;
	}
	public void setControllerParameter(String controllerParameter) {
		this.controllerParameter = controllerParameter;
	}
	public String getControllerReceiver() {
		return controllerReceiver;
	}
	public void setControllerReceiver(String controllerReceiver) {
		this.controllerReceiver = controllerReceiver;
	}
	public String getSwitchStyle() {
		return switchStyle;
	}
	public void setSwitchStyle(String switchStyle) {
		this.switchStyle = switchStyle;
	}
	public String getSwitchPanelId() {
		return switchPanelId;
	}
	public void setSwitchPanelId(String switchPanelId) {
		this.switchPanelId = switchPanelId;
	}

	public String getCurrentState() {
		return currentState;
	}

	public void setCurrentState(String currentState) {
		this.currentState = currentState;
	}
	
	public String getCheckBoxState() {
		if(this.currentState != null && this.currentState.equals(ON)) {
			return CHECKBOX_CHECKED;
		}else {
			return CHECKBOX_UNCHECKED;
		}
	}
	
	public boolean getFieldValue() {
		return this.currentState.equals(ON);
	}

	public String getSwitchSetting(){
		if(currentState.equals(ON)){
			return Timer.TIMERSETTING_ON;
		}else{
			return Timer.TIMERSETTING_OFF;
		}
	}
	
	@Override
	public String toString() {
		return "Switch [name=" + name + ", icon=" + icon
				+ ", controllerParameter=" + controllerParameter
				+ ", controllerReceiver=" + controllerReceiver
				+ ", switchStyle=" + switchStyle + ", currentState="
				+ currentState + "]";
	}
	
	

}